package com.qyy.remotemonitor;

import android.content.Context;
import android.util.Log;

import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.Utils;
import com.qyy.remotemonitor.common.di.AppCommonComponent;
import com.qyy.remotemonitor.common.di.AppCommonModule;
import com.qyy.remotemonitor.common.di.DaggerAppCommonComponent;
import com.ttsea.jrxbus2.RxBus2;
import com.wang.android.library.FBaseApplication;

import io.realm.Realm;

/**
 * Created by WangHuanyu on 2018/1/2.
 */

public class MyApplication extends FBaseApplication{
    AppCommonComponent aComponent;
    @Override
    public void onCreate() {
        super.onCreate();
        long time = System.currentTimeMillis();
        aComponent = DaggerAppCommonComponent.builder().appCommonModule(new AppCommonModule(this)).build();

        // logUtil init
        Utils.init(this);
        LogUtils.getConfig().setLogHeadSwitch(false).setBorderSwitch(false).setLogSwitch(BuildConfig.LOG).setLog2FileSwitch(BuildConfig.LOG_W_FILE);
        RxBus2.getInstance().debugMode(BuildConfig.LOG);

        //Realm
        LogUtils.d("init realm");
        Realm.init(this);
      /*  Log.e("qqqqqqqqqq","allpication cost time is " + (System.currentTimeMillis()- time));*/
    }

    public AppCommonComponent getAppCommonComponent() {
        return aComponent;
    }

}
